package krt.com.kotlinstudy.kotlinactivity

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_ko_text.*

import krt.com.kotlinstudy.R

class KoTextActivity : AppCompatActivity(),View.OnClickListener {
    override fun onClick(v: View?) {

        when(v?.id){
            R.id.bt_tko1 ->{
                Toast.makeText(this,bt_tko1.text,Toast.LENGTH_SHORT).show()
            }
            R.id.bt_tko2 ->{
                Toast.makeText(this,bt_tko2.text,Toast.LENGTH_SHORT).show()
            }
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_ko_text)
        bt_tko1.text="测试"
        bt_tko1.setOnClickListener(this)
        bt_tko2.setOnClickListener(this)
    }
}
